import java.util.*;
class Circle{
    private double radius;
    public Circle(){
    }
    public Circle(double radius){
        this.radius=radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
    public double getArea(){
        return Math.PI*this.getRadius()*this.getRadius();
    }
    public double getPerimeter(){
        return Math.PI*2*this.getRadius();
    }
    @Override
    public String toString() {
        return "Circle(r:"+String.format("%.2f", radius)+")";
    }
}
class Cone{
    private double height;
    private Circle circle;
    public Cone(){

    }
    public Cone(double height, Circle circle) {
        this.height = height;
        this.circle = circle;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public Circle getCircle() {
        return circle;
    }

    public void setCircle(Circle circle) {
        this.circle = circle;
    }
    public double getVolume(){
        return 1/3.00*this.getHeight()*this.getCircle().getArea();
    }

    @Override
    public String toString() {
        return "Cone(h:"+String.format("%.2f", height)+","+circle+")";
    }
}
//线程类：计算整数序列和
class SumList extends Thread
{
    private ArrayList lt=null;//存放整数序列的列表
    SumList(ArrayList lt){
        this.lt=lt;
    }
    //线程体
    public void run() {
        int sum=0;
        for (int i = 0; i < lt.size(); i++)
            sum += (int) (lt.get(i));
//取出序列元素累加
        System.out.println(sum);
    }
}
//测试类
class Student{
    public String s1;
    public String s2;
    public int s3;
    public Student(String s1, String s2, int s3) {
        this.s1 = s1;
        this.s2 = s2;
        this.s3 = s3;
    }

    @Override
    public String toString() {
        return "Student{" +
                "s1='" + s1 + '\'' +
                ", s2='" + s2 + '\'' +
                ", s3=" + s3 +
                '}';
    }
}
class Fruit{
    public void showNumber(int num)
    {//父类方法的定义
        System.out.println("现在有"+num+"个水果");
    }
}
class Apple extends Fruit{
    @Override
    //保证正确重写方法的注解
    public void showNumber(int num) {
        System.out.println("现在有"+num+"个苹果");
    }
}
public class ada {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<Student>();
        list.add(new Student("2016001", "rose", 18));
        list.add(new Student("2016002", "hunifu", 19));
        list.add(new Student("2016003", "britsh", 20));
        Iterator<Student> it =list.listIterator();
        while (it.hasNext()) { //判断遍历是否结束
            Student stu = it.next();//取列表元素
            System.out.println(stu);
        }
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();//输入序列个数
        int m=sc.nextInt();//输入每个序列中的整数个数
        for (int i = 0; i < n; i++) {


            ArrayList<Integer> score = new ArrayList<>();
//创建求和列表对象
            for (int j = 0; j < m; j++) {
                score.add(sc.nextInt());
            }


            SumList sl = new SumList(score);

            Thread th=new Thread(sl);//创建线程对象


            th.start();
//启动线程
        }
        sc.close();
    }

}
